#include "SIFTTracker.h"
#include "opencv2/opencv.hpp"
#include <string>
#include <iostream>

#include "PACC/config.hpp"
#include "PACC/Util.hpp"

using namespace std;

int x[] = {51,-1,68};
int y[] = {138,-1,137};
int w[] = {559,-1,530};
int h[] = {194,-1,187};

using namespace cv;

int main( int argc, char** argv )
{
	DATFrameSIFT* lFrame = new DATFrameSIFT;
	DATObjectSIFT* lCar1 = new DATObjectSIFT;
	DATObjectSIFT* lCar2 = new DATObjectSIFT;
	lFrame->mActualFrame = imread("D:/Usagers/matre697/Data.nobkp/Test_affine/Essai_RAW_001.bmp");
	//lCar1->mLastSeenObject = imread("D:/Usagers/matre697/Data.nobkp/Test_affine/nocar.png");//imageclipper/01.png");
	lCar1->mLastSeenObject = imread("D:/Usagers/matre697/Data.nobkp/Test_affine/imageclipper/01.png");
	lCar2->mLastSeenObject = imread("D:/Usagers/matre697/Data.nobkp/Test_affine/imageclipper/03.png");
	lCar1->mLastPosition = cv::Rect(cv::Point(x[0],y[0]),cv::Size(w[0],h[0]));
	lCar2->mLastPosition = cv::Rect(cv::Point(x[2],y[2]),cv::Size(w[2],h[2]));
	lFrame->mFramePos = 0;
	lCar1->mFramePos = 0;
	lCar2->mFramePos = 2;
	SIFTTracker* lTracker1 = new SIFTTracker(lCar1);
	SIFTTracker* lTracker2 = new SIFTTracker(lCar2);

	double lConfidence[10];
	std::pair<cv::Point,double> lDisp[10];

	lTracker1->findObjectInFrame(lFrame,lDisp[0],&lConfidence[0]);
	lTracker2->findObjectInFrame(lFrame,lDisp[1],&lConfidence[1]);

	//Test 2 the matching of 2 same object
	lTracker1->compareObjects(lCar1,&lConfidence[2]);
	lTracker2->compareObjects(lCar2,&lConfidence[3]);

	//Test 2 the matching of 2 same object
	lTracker1->compareObjects(lCar2,&lConfidence[4]);
	lTracker2->compareObjects(lCar1,&lConfidence[5]);

	//Destructor Test
	delete lTracker1;
	delete lTracker2;
	delete lCar1;
	delete lCar2;
	delete lFrame;
}